package adminLog

import (
	"grpc.getaway.adminspro.padmins.com/internal/api/module/admin/container"
	"grpc.getaway.adminspro.padmins.com/internal/api/utils/rpc"
	pbAdmin "grpc.getaway.adminspro.padmins.com/pkg/proto/admin"
	"strconv"
	"strings"
)

func Del(c *container.Context) (interface{}, error) {

	ids := strings.Split(c.Request.ParamsToString("id"), ",")

	req := &pbAdmin.AdminOperationLogDelReq{
		Id:         make([]int64, len(ids)),
		OperaterId: c.Auth.Data.Admin.Id,
	}

	for i, id := range ids {
		req.Id[i], _ = strconv.ParseInt(id, 10, 64)
	}

	return rpc.GetAdminClient().AdminOperationLogDel(c.GetContext(), req)
}
